# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1SecurityAction do
  @moduledoc """
  A SecurityAction is rule that can be enforced at an environment level. The result is one of: - A denied API call - An explicitly allowed API call - A flagged API call (HTTP headers added before the target receives it) At least one condition is required to create a SecurityAction.

  ## Attributes

  *   `allow` (*type:* `GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1SecurityActionAllow.t`, *default:* `nil`) - Allow a request through if it matches this SecurityAction.
  *   `apiProxies` (*type:* `list(String.t)`, *default:* `nil`) - Optional. If unset, this would apply to all proxies in the environment. If set, this action is enforced only if at least one proxy in the repeated list is deployed at the time of enforcement. If set, several restrictions are enforced on SecurityActions. There can be at most 100 enabled actions with proxies set in an env. Several other restrictions apply on conditions and are detailed later.
  *   `conditionConfig` (*type:* `GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1SecurityActionConditionConfig.t`, *default:* `nil`) - Required. A valid SecurityAction must contain at least one condition.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The create time for this SecurityAction.
  *   `deny` (*type:* `GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1SecurityActionDeny.t`, *default:* `nil`) - Deny a request through if it matches this SecurityAction.
  *   `description` (*type:* `String.t`, *default:* `nil`) - Optional. An optional user provided description of the SecurityAction.
  *   `expireTime` (*type:* `DateTime.t`, *default:* `nil`) - The expiration for this SecurityAction.
  *   `flag` (*type:* `GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1SecurityActionFlag.t`, *default:* `nil`) - Flag a request through if it matches this SecurityAction.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Immutable. This field is ignored during creation as per AIP-133. Please set the `security_action_id` field in the CreateSecurityActionRequest when creating a new SecurityAction. Format: organizations/{org}/environments/{env}/securityActions/{security_action}
  *   `state` (*type:* `String.t`, *default:* `nil`) - Required. Only an ENABLED SecurityAction is enforced. An ENABLED SecurityAction past its expiration time will not be enforced.
  *   `ttl` (*type:* `String.t`, *default:* `nil`) - Input only. The TTL for this SecurityAction.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The update time for this SecurityAction. This reflects when this SecurityAction changed states.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :allow => GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1SecurityActionAllow.t() | nil,
          :apiProxies => list(String.t()) | nil,
          :conditionConfig =>
            GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1SecurityActionConditionConfig.t() | nil,
          :createTime => DateTime.t() | nil,
          :deny => GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1SecurityActionDeny.t() | nil,
          :description => String.t() | nil,
          :expireTime => DateTime.t() | nil,
          :flag => GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1SecurityActionFlag.t() | nil,
          :name => String.t() | nil,
          :state => String.t() | nil,
          :ttl => String.t() | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:allow, as: GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1SecurityActionAllow)
  field(:apiProxies, type: :list)

  field(:conditionConfig,
    as: GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1SecurityActionConditionConfig
  )

  field(:createTime, as: DateTime)
  field(:deny, as: GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1SecurityActionDeny)
  field(:description)
  field(:expireTime, as: DateTime)
  field(:flag, as: GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1SecurityActionFlag)
  field(:name)
  field(:state)
  field(:ttl)
  field(:updateTime, as: DateTime)
end

defimpl Poison.Decoder, for: GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1SecurityAction do
  def decode(value, options) do
    GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1SecurityAction.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1SecurityAction do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
